import base from './index'
let axios = base.axios
let baseUrl = base.baseUrl

//注册接口
export const RegisterService = (DataObj) =>{
    //借助urlsearchParams完成传递
    const params = new URLSearchParams()
    for(let key in DataObj){
        params.append(key,DataObj[key]);
    }
    console.log("register"+params)
     return axios({
        method: 'post',
        baseURL: `${baseUrl}/register`,
        data: params
      }).then(res => res.data)
}

//登录接口
export const LoginService =(registerData)=>{
   const params = new URLSearchParams();
   for(let key in registerData){
      params.append(key,registerData[key])
   }
   console.log("login"+params)
     return axios({
        method: 'post',
        baseURL: `${baseUrl}/login`,
        data: params
      }).then(res => res.data)
}